<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
	var arr=[1,2,3,4,5];
	//传一个参数
	var arr2=arr.slice(2);
	console.log(arr2);//[3, 4, 5]返回从指定位置开始到当前数组末尾的所有项组成的数组
	//传两个参数
	var arr3=arr.slice(1,3);
	
	console.log(arr3);//[2, 3]
	//传两个负数 用arr.length加上该数字来确定位置
	var arr4=arr.slice(-1,-3);
	var arr5=arr.slice(4,2);

	console.log(arr4)//[]
	
	var arr6=arr.slice(-4,-2);
	console.log(arr6);//[2, 3]
	
	
	
</script>
</head>

<body>
</body>
</html>
